package com.wing.inventory.controller;

import com.wing.common.utils.JsonResult;
import com.wing.inventory.entity.request.InventoryClassRequest;
import com.wing.inventory.entity.response.CurrentStockResponse;
import com.wing.inventory.entity.response.InventoryClassResponse;
import com.wing.inventory.entity.response.InventoryResponse;
import com.wing.inventory.entity.response.InventoryUnitResponse;
import com.wing.inventory.service.InventoryService;
import com.wing.warehouse.entity.response.WarehouseQueryResponse;
import com.wing.warehouse.service.WarehouseService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 畅捷通-存货管理1
 *
 * @author xiayang
 */
@Validated
@Api(value = "畅捷通-存货管理", tags = "#/chanjet/inventory")
@RestController("chanjetInventoryController")
@RequestMapping("inventory/admin/inventory")
@RequiredArgsConstructor

public class InventoryController {

    @Resource
    InventoryService inventoryService;

    /**
     * 存货分类创建
     */
    @PostMapping("/class/create")
    public JsonResult inventoryClassCreate(InventoryClassRequest inventoryClassRequest) {
        return JsonResult.success(inventoryService.inventoryClassCreate(inventoryClassRequest));
    }

    /**
     * 存货分类查询
     */
    @PostMapping("/class/query")
    public JsonResult<List<InventoryClassResponse>> inventoryClassQuery() {
        return JsonResult.success(inventoryService.inventoryClassQuery());
    }

    /**
     * 存货计量单位查询
     */
    @PostMapping("/unit/query")
    public JsonResult<List<InventoryUnitResponse>> inventoryUnitQuery(@RequestParam("code") String code) {
        return JsonResult.success(inventoryService.inventoryUnitQuery(code));
    }

    /**
     * 存货查询
     */
    @PostMapping("/query")
    public JsonResult<List<InventoryResponse>> query() {
        return JsonResult.success(inventoryService.inventoryQuery());
    }

    /**
     * 现存量查询
     */
    @PostMapping("/currentStock/query")
    public JsonResult<List<CurrentStockResponse>> currentStockQuery() {
        return JsonResult.success(inventoryService.currentStockQuery());
    }

}
